package com.job.Yangmingyu.Zuoye0722.Zuoye1;

import com.job.DQH.dqh722.homework01.AgeException;

/**
 * @author Yangmingyu
 * @version 1.0
 * @since 2022-07-22 21:43:18
 */
public class Student {
    private String name;
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Student() {
    }


    public String getName(String s) {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }
    public String getName() {
        return name;
    }
    public void setAge(int age) throws Exception00 {
        if(age >= 18 && age <= 28){
            this.age = age;
        } else {
            throw new Exception00(age+"年龄有误");
        }
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}